<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>

        // 定义一个函数
        function fn(n = 5) {
            let total = 1;
            while (n > 1) {
                total *= n
                n--
            }

            return total
        }

        let r1 = fn(12)
        let r2 = fn(10)
        let r3 = fn()

        // 把r1打印在控制台
        console.log(r1);
        console.log(r3);
        

        // 把r2输出到页面上
        document.write(r2)
    </script>
</body>

</html>